package com.wonders.hisdoctor.station.project.record.mapper;

import com.wonders.hisdoctor.station.project.base.domain.*;
import com.wonders.hisdoctor.station.project.hisqueue.vo.ClinicMasterQueryVo;
import com.wonders.hisdoctor.station.project.medicine.vo.QryClinicVO;
import com.wonders.hisdoctor.station.project.record.vo.StaticData;
import com.wonders.hisdoctor.station.project.record.vo.StaticEditor;
import com.wonders.hisdoctor.station.project.record.vo.TemplateListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Description: 病例
 *
 * @author tong-aj
 * <p>
 * Create: 2021-02-22 17:09
 */
@Mapper
@Repository
public interface RecordUseMapper {

    /**
    * Description: 通过表名，查询所有的字段名
    * Param: [tableName]
    * return: java.util.List<java.lang.String>
    * Author: tong-aj
    * Date: 2021/2/22
    */
    List<String> getTableColumns(String tableName);

    /**
    * Description: 根据表名字段名，查所该字段所有值
    * Param: [tableName, columnName]
    * return: java.lang.String
    * Author: tong-aj
    * Date: 2021/2/22
    */
    List<String> getColumnValues(@Param("tableName") String tableName, @Param("codeColumn") String codeColumn, @Param("valueColumn") String valueColumn);

    /**
    * Description: 根据setId更新静态数据
    * Param: [wdeditorDssetStatic]
    * return: void
    * Author: tong-aj
    * Date: 2021/2/25
    */
    void updateWdeditorDssetStaticBySetId(@Param("wdeditorDssetStatic") WdeditorDssetStatic wdeditorDssetStatic);

    /**
    * Description: 根据setId更新业务数据
    * Param: [wdeditorDssetLoad]
    * return: void
    * Author: tong-aj
    * Date: 2021/2/25
    */
    void updateWdeditorDssetLoadBySetId(@Param("wdeditorDssetLoad") WdeditorDssetLoad wdeditorDssetLoad);

    /**
    * Description: 根据setId更新数据源配置表_存储
    * Param: [wdeditorDssetStorge]
    * return: void
    * Author: tong-aj
    * Date: 2021/2/25
    */
    void updateWdeditorDssetStorgeBySetId(@Param("wdeditorDssetStorge") WdeditorDssetStorge wdeditorDssetStorge);

    /**
    * Description: 根据setId更新默认值等信息
    * Param:
    * return:
    * Author: tong-aj
    * Date: 2021/2/25
    */
    void updateWdeditorDssetPropertyBySetId(@Param("wdeditorDssetProperty") WdeditorDssetProperty wdeditorDssetProperty);

    /**
    * Description: 取静态数据源
    * Param: [tableName, staticShowField, staticStorageField]
    * return: java.util.List<com.wonders.hisdoctor.station.project.record.vo.StaticData>
    * Author: tong-aj
    * Date: 2021/2/26
    */
    List<Map<String,Object>> getStaticData(@Param("tableName") String tableName, @Param("staticShowField") String staticShowField, @Param("staticStorageField") String staticStorageField);

    /**
     * 拼装sql
     * @param columnStr 字段
     * @param tableStr 表名
     * @param whereStr 条件
     * @return 集合
     */
    Map<String, Object> getTableData(@Param("columnStr") String columnStr, @Param("tableStr") String tableStr, @Param("whereStr") String whereStr);

    /**
    * Description: 根据modelId把所有模板信息删除
    * Param: [s]
    * return: void
    * Author: tong-aj
    * Date: 2021/3/3
    */
    void deleteModelData(String modelId);

    /**
    * Description: 根据诊断code查询诊断name
    * Param: [strings]
    * return: java.util.List<java.lang.String>
    * Author: tong-aj
    * Date: 2021/3/8
    */
    List<Map<String,String>> getDiagValueOfCodes(List<String> strings);

    /**
    * Description: 根据中医诊断code查询诊断name
    * Param: [strings]
    * return: java.util.List<java.lang.String>
    * Author: tong-aj
    * Date: 2021/3/8
    */
    List<Map<String,String>> getTmDiagValueOfCodes(List<String> strings);

    /**
    * Description: 根据中医诊断证型code查询诊断name
    * Param: [strings]
    * return: java.util.List<java.lang.String>
    * Author: tong-aj
    * Date: 2021/3/9
    */
    List<Map<String,String>> getTmTypeValueOfCodes(List<String> strings);

    /**
    * Description: 根据表名查询总数量
    * Param: [tableName]
    * return: int
    * Author: tong-aj
    * Date: 2021/3/10
    */
    int getTableCounts(String tableName);

    /**
    * Description: 根据医疗机构代码合模板查询字段查询所有Model
    * Param: [hospitalCode, fastFind]
    * return: java.util.List<com.wonders.hisdoctor.station.project.base.domain.WdeditorDsset>
    * Author: tong-aj
    * Date: 2021/3/12
    */
    List<Map<String,Object>> getModelList(String hospitalCode, String fastFind);

    /**
    * Description: 批量删除模板
    * Param: [modelIds]
    * return: void
    * Author: tong-aj
    * Date: 2021/3/16
    */
    void deleteModels(List<String> modelIds);

    /**
    * Description: 病历模板查询
    * Param: [orgId]
    * return: java.util.List<com.wonders.hisdoctor.station.project.record.vo.TemplateListVo>
    * Author: tong-aj
    * Date: 2021/4/20
    */
    List<TemplateListVo> selectTemplateList(@Param("orgId") String orgId, @Param("effectiveDept") String effectiveDept, @Param("templateName") String templateName, @Param("condition") String condition);

    /**
    * Description: 批量删除病历模板
    * Param: [tIds]
    * return: void
    * Author: tong-aj
    * Date: 2021/4/16
    */
    void deleteTemplateList(List<String> tIds);

    /**
     * 根据下拉框条件查询病历左侧记录
     * @param qryClinicVO qryClinicVO
     * @return List<ClinicMasterQueryVo>
     */
    List<ClinicMasterQueryVo> selectMrList(QryClinicVO qryClinicVO);

    /**
     * 通过modelId获取下拉控件的静态数据源需要信息
     * @param modelId
     * @return
     */
    List<StaticEditor> getStaticEditors(String modelId);
}
